<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" th:href="@{/bootstrap/css/bootstrap.css}">
    <link rel="stylesheet" th:href="@{/css/common.css}">
</head>
<body>
<div th:insert="~{common/header::header2}"></div>
<div class="container-fluid">
    <div class="row">
        <div th:insert="~{common/menu::menu}" class="col-md-2"></div>
        <div class="col-md-10">
            <ul class="breadcrumb">
                <li><a th:href="@{/main.do}">后台主页</a></li>
                <li>患者信息管理</li>
                <li>行程管理</li>
            </ul>
            <div class="col-sm-4">
                <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal" data-whatever="添加行程信息">
                    <i class="glyphicon glyphicon-plus"></i>
                </button>
            </div>
            <table class="table table-striped">
                <colgroup>
                    <col span="3" width="150px">
                    <col width ="170px">
                    <col span="6" width="150px">
                </colgroup>
                <thead>
                <tr>
                    <th>线索来源</th>
                    <th>日期</th>
                    <th>行程类型</th>
                    <th>车次/车牌/航班/场所名</th>
                    <th>车厢</th>
                    <th>出发站</th>
                    <th>到达站</th>
                    <th>出发时间</th>
                    <th>到达时间</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                <tr th:each="list:${pageInfo.list}">
                    <td th:text="${list.getSource()}"></td>
                    <td th:text="${#dates.format(list.getDate(),'yyyy-MM-dd')}"></td>
                    <td th:if="${list.getTripTypeNum() eq 1}" th:text="飞机"></td>
                    <td th:if="${list.getTripTypeNum() eq 2}" th:text="火车"></td>
                    <td th:if="${list.getTripTypeNum() eq 3}" th:text="地铁"></td>
                    <td th:if="${list.getTripTypeNum() eq 4}" th:text="大巴"></td>
                    <td th:if="${list.getTripTypeNum() eq 5}" th:text="公交车"></td>
                    <td th:if="${list.getTripTypeNum() eq 6}" th:text="出租车"></td>
                    <td th:if="${list.getTripTypeNum() eq 7}" th:text="轮船"></td>
                    <td th:if="${list.getTripTypeNum() eq 8}" th:text="其他公共场所"></td>
                    <td th:text="${list.getVehicleNum()}"></td>
                    <td th:if="${list.getCarriageNum() ne '-1'}" th:text="${list.getCarriageNum()}"></td>
                    <td th:if="${list.getCarriageNum() eq '-1'}"></td>
                    <td th:text="${list.getStartPlace()}"></td>
                    <td th:text="${list.getEndPlace()}"></td>
                    <td th:text="${#dates.format(list.getStartDate(),'yyyy-MM-dd HH:mm:ss')}"></td>
                    <td th:text="${#dates.format(list.getEndDate(),'yyyy-MM-dd HH:mm:ss')}"></td>
                    <td>
                        <a style="color: white" th:href="@{/trip-info/toUpdate.do(id=${list.getTripId()})}"><button class="btn btn-sm btn-primary">编辑</button></a>
                        <a style="color: white" th:href="@{/trip-info/delete.do(id=${list.getTripId()})}"><button class="btn btn-sm btn-danger">删除</button></a>
                    </td>
                </tr>
                </tbody>
            </table>
            <nav aria-label="Page navigation example">
                <ul class="pagination">
                    <li class="page-item"><a class="page-link" th:href="@{/trip-info/show.do(pn=)}">首页</a></li>
                    <li class="page-item" th:if="${pageInfo.hasPreviousPage}">
                        <a class="page-link" th:href="@{/trip-info/show.do(pn=${pageInfo.pageNum - 1})}">Previous</a>
                    </li>
                    <li th:each="pageNum:${pageInfo.navigatepageNums}">
                        <a th:if="${pageNum==pageInfo.pageNum}" class="page-link" th:href="@{#}" th:text="${pageNum}"></a>
                        <a th:if="${pageNum!=pageInfo.pageNum}" class="page-link" th:href="@{/trip-info/show.do(pn=${pageNum})}" th:text="${pageNum}"></a>
                    </li>
                    <li class="page-item" th:if="${pageInfo.hasNextPage}">
                        <a class="page-link" th:href="@{/trip-info/show.do(pn=${pageInfo.pageNum+1})}">Next</a>
                    </li>
                    <li class="page-item">
                        <a class="page-link" th:href="@{/trip-info/show.do(pn=${pageInfo.pages})}">尾页</a>
                    </li>
                </ul>
            </nav>
        </div>
    </div>
</div>
<!-- 弹出框 -->
<div class="modal fade" id="exampleModal">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="exampleModalLabel">添加行程信息</h4>
            </div>
            <div class="modal-body ">
                <div align="center">
                    <span style="color:red;"></span>
                    <form name="articleform" class="form-horizontal" th:action="@{/trip-info/input.do}">
                        <div class="form-group row justify-content-sm-center">
                            <label for="source" class="col-sm-2 col-form-label font-weight-bolder">线索来源</label>
                            <div class="col-sm-5">
                                <input type="text"  class="form-control" id="source" name="source">
                            </div>
                            <div class="col-sm-3">

                            </div>
                        </div>
                        <div class="form-group row justify-content-sm-center">
                            <label for="date" class="col-sm-2 col-form-label font-weight-bolder">日期</label>
                            <div class="col-sm-5">
                                <input type="text"  class="form-control" id="date" name="date">
                            </div>
                            <div class="col-sm-3">

                            </div>
                        </div>
                        <div class="form-group row justify-content-sm-center">
                            <label for="tripTypeNum" class="col-sm-2 col-form-label font-weight-bolder">行程类型</label>
                            <div class="col-sm-5">
                                <input type="text"  class="form-control" id="tripTypeNum" name="tripTypeNum">
                            </div>
                            <div class="col-sm-3">
                                <span id="userNameErr"></span>
                            </div>
                        </div>
                        <div class="form-group row justify-content-sm-center">
                            <label for="vehicleNum" class="col-sm-2 col-form-label font-weight-bolder">车次/车牌/航班/场所名</label>
                            <div class="col-sm-5">
                                <input type="text"  class="form-control" id="vehicleNum" name="vehicleNum">
                            </div>
                            <div class="col-sm-3">

                            </div>
                        </div>
                        <div class="form-group row justify-content-sm-center">
                            <label for="carriageNum" class="col-sm-2 col-form-label font-weight-bolder">车厢</label>
                            <div class="col-sm-5">
                                <input type="text"  class="form-control" id="carriageNum" name="carriageNum">
                            </div>
                            <div class="col-sm-3">

                            </div>
                        </div>
                        <div class="form-group row justify-content-sm-center">
                            <label for="startPlace" class="col-sm-2 col-form-label font-weight-bolder">出发站</label>
                            <div class="col-sm-5">
                                <input type="text"  class="form-control" id="startPlace" name="startPlace">
                            </div>
                            <div class="col-sm-3">

                            </div>
                        </div>
                        <div class="form-group row justify-content-sm-center">
                            <label for="endPlace" class="col-sm-2 col-form-label font-weight-bolder">到达站</label>
                            <div class="col-sm-5">
                                <input type="text"  class="form-control" id="endPlace" name="endPlace">
                            </div>
                            <div class="col-sm-3">

                            </div>
                        </div>
                        <div class="form-group row justify-content-sm-center">
                            <label for="startDate" class="col-sm-2 col-form-label font-weight-bolder">出发时间</label>
                            <div class="col-sm-5">
                                <input type="text"  class="form-control" id="startDate" name="startDate">
                            </div>
                            <div class="col-sm-3">

                            </div>
                        </div>
                        <div class="form-group row justify-content-sm-center">
                            <label for="endDate" class="col-sm-2 col-form-label font-weight-bolder">到达时间</label>
                            <div class="col-sm-5">
                                <input type="text"  class="form-control" id="endDate" name="endDate">
                            </div>
                            <div class="col-sm-3">

                            </div>
                        </div>
                        <table>
                            <tr>
                                <td><input type="submit" class="btn btn-success btn-sm" value="提交" id="btn-submit"/></td>
                                <td>&nbsp;&nbsp;<input type="button" class="btn btn-danger btn-sm" data-dismiss="modal" value="取消" /></td>
                            </tr>
                        </table>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
<script th:src="@{/jquery/jquery-3.5.1.js}"></script>
<script th:src="@{/bootstrap/js/bootstrap.js}"></script>
<script th:inline="javascript">

</script>
</html>